home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libexif / exif-mem.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-06-13  |  2.5 KB  |  85 lines

  1. /*! \file exif-mem.h
  2.  *  \brief Define the ExifMem data type and the associated functions.
  3.  *  ExifMem defines the memory management functions used by the ExifLoader.
  4.  */
  5.  
  6. /* exif-mem.h
  7.  *
  8.  * Copyright ⌐ 2003 Lutz Mⁿller <lutz@users.sourceforge.net>
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Lesser General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful, 
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  * Lesser General Public License for more details. 
  19.  *
  20.  * You should have received a copy of the GNU Lesser General Public
  21.  * License along with this library; if not, write to the
  22.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  23.  * Boston, MA 02111-1307, USA.
  24.  */
  25.  
  26. #ifndef __EXIF_MEM_H__
  27. #define __EXIF_MEM_H__
  28.  
  29. #include <libexif/exif-utils.h>
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif /* __cplusplus */
  34.  
  35. /*! Should work like calloc()
  36.  *  \param[in] s the size of the block to allocate.
  37.  *  \returns the allocated memory and initialized. 
  38.  */
  39. typedef void * (* ExifMemAllocFunc)   (ExifLong s);
  40.  
  41. /*! Should work like realloc()
  42.  * \param[in] p the pointer to reallocate
  43.  * \param[in] s the size of the reallocated block
  44.  * \returns allocated memory 
  45.  */
  46. typedef void * (* ExifMemReallocFunc) (void *p, ExifLong s);
  47. /*! Free method for ExifMem
  48.  * \param[in] p the pointer to free
  49.  * \returns the freed pointer
  50.  */
  51. typedef void   (* ExifMemFreeFunc)    (void *p);
  52.  
  53. /*! ExifMem define a memory allocator */
  54. typedef struct _ExifMem ExifMem;
  55.  
  56. /*! Create a new ExifMem
  57.  * \param[in] a the allocator function
  58.  * \param[in] r the reallocator function
  59.  * \param[in] f the free function
  60.  */
  61. ExifMem *exif_mem_new   (ExifMemAllocFunc a, ExifMemReallocFunc r,
  62.              ExifMemFreeFunc f);
  63. /*! Refcount an ExifMem
  64.  */
  65. void     exif_mem_ref   (ExifMem *);
  66. /*! Unrefcount an ExifMem
  67.  * If the refcount reaches 0, the ExifMem is freed
  68.  */
  69. void     exif_mem_unref (ExifMem *);
  70.  
  71. void *exif_mem_alloc   (ExifMem *m, ExifLong s);
  72. void *exif_mem_realloc (ExifMem *m, void *p, ExifLong s);
  73. void  exif_mem_free    (ExifMem *m, void *p);
  74.  
  75. /*! The default ExifMem for your convenience
  76.  * \returns return the default ExifMem
  77.  */
  78. ExifMem *exif_mem_new_default (void);
  79.  
  80. #ifdef __cplusplus
  81. }
  82. #endif /* __cplusplus */
  83.  
  84. #endif /* __EXIF_MEM_H__ */
  85.